package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicPayReturnDAO;
import com.cssy.xxkj.logic.entity.LogicPayReturnDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-10-11
 */
public class LogicPayReturnDAOImpl extends SqlMapClientDaoSupport implements LogicPayReturnDAO {

    /**
     * 插入数据
     * @param logicPayReturnDO
     * @return 插入数据的主键
     */
    public String insertLogicPayReturnDO(LogicPayReturnDO logicPayReturnDO) {
        Object id = getSqlMapClientTemplate().insert("LogicPayReturn.insert", logicPayReturnDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicPayReturnDO
     * @return 查出的记录数
     */
    public Integer countLogicPayReturnDOByExample(LogicPayReturnDO logicPayReturnDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPayReturn.countByDOExample", logicPayReturnDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicPayReturnDO
     * @return 受影响的行数
     */
    public Integer updateLogicPayReturnDO(LogicPayReturnDO logicPayReturnDO) {
        int result = getSqlMapClientTemplate().update("LogicPayReturn.update", logicPayReturnDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicPayReturnDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicPayReturnDO> findListByExample(LogicPayReturnDO logicPayReturnDO) {
        List<LogicPayReturnDO> list = getSqlMapClientTemplate().queryForList("LogicPayReturn.findListByDO", logicPayReturnDO);
        return list;
    }

    /**
     * 根据主键获取logicPayReturnDO
     * @param id
     * @return logicPayReturnDO
     */
    public LogicPayReturnDO findLogicPayReturnDOByPrimaryKey(String id) {
        LogicPayReturnDO logicPayReturnDO = (LogicPayReturnDO) getSqlMapClientTemplate().queryForObject("LogicPayReturn.findByPrimaryKey", id);
        return logicPayReturnDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicPayReturnDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPayReturn.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicPayReturnDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicPayReturnDO> list=getSqlMapClientTemplate().queryForList("LogicPayReturn_ex.find",scs);
		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count=(Integer)getSqlMapClientTemplate().queryForObject("LogicPayReturn_ex.count",scs);
		return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().update("LogicPayReturn_ex.deleteBizRemoved", id);
        return count;
	}

}